<?php

/**
 * Created by JetBrains PhpStorm.
 * User: jh
 * Date: 12-10-1
 * Time: 下午6:17
 * To change this template use File | Settings | File Templates.
 */
class Setup_ErrorReporting extends Setup_Abstract implements Setup_Interface
{

    public function setup()
    {

        ini_set('error_log', Config::get('app.log_path'));

        ini_set('log_errors', '1');

        date_default_timezone_set(Config::get('system.time_zone'));

        switch (Config::get('app.development_mode'))
        {

            case TESTING_MODE:

                ini_set('display_errors', '1');

                ini_set('display_startup_errors', '1');

                error_reporting(E_ALL);

                break;

            case DEV_MODE:

                ini_set('display_errors', '1');

                ini_set('display_startup_errors', '0');

                error_reporting(E_ERROR | E_WARNING | E_PARSE);

                break;

            case LIVE_MODE:

                ini_set('display_errors', '0');

                ini_set('display_startup_errors', '0');

                error_reporting(0);

                break;
        }

    }

}
